<?php
/**
 * Created by PhpStorm.
 * User: wangchaozhen
 * Date: 2018/6/9
 * Time: 15:06
 */
namespace App\Http\Validate\Customer;
use Validator;


class address
{
    public static function validate($request)
    {
        $rules = [
            'uid' => 'required',
            'address' => 'required',
            'name' => 'required',
            'phone' => 'required|max:11',
            'province_id' => 'required',
            'province' => 'required',
            'city_id' => 'required',
            'city' => 'required'
        ];

        $message = [
            'uid.required' => '用户id不能为空',
            'address.required' => '地址不能为空',
            'name.required' => '姓名不能为空',
            'phone.required' => '电话号码不能为空',
            'province_id.required' => '省信息不能为空',
            'province.required' => '省信息不能为空',
            'city_id.required' => '市信息不能为空',
            'city.required' => '市信息不能为空'
        ];

        $validator = Validator::make($request->all(),$rules,$message);
        $errors = $validator->errors()->all();

        return $errors;
    }
}